package com.zeno.soil.rbac.controller;

import com.zeno.soil.rbac.model.vo.RoleCreateVO;
import com.zeno.soil.rbac.model.vo.RoleItemVO;
import com.zeno.soil.rbac.model.vo.RoleUpdateVO;
import com.zeno.soil.rbac.model.vo.RoleVO;
import com.zeno.soil.rbac.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author zeno
 */
@RestController
@RequestMapping("v1/roles")
public class RoleController{

  private RoleService roleService;
  @GetMapping
  public List<RoleItemVO> list(){
    return this.roleService.findRoles();
  }

  @GetMapping("{code}")
  public RoleVO get(@PathVariable("code")String code){
    return null;
  }

  @PostMapping
  public RoleVO add(@RequestBody RoleCreateVO createVO ){
    return null;
  }

  @PutMapping("{code}")
  public RoleVO update(@PathVariable("code")String code,@RequestBody RoleUpdateVO updateVO ){
    return null;
  }



  @DeleteMapping("{code}")
  public void delete(@PathVariable("code")String code){
  }

  @Autowired
  public void setRoleService( RoleService roleService ){
    this.roleService = roleService;
  }
}
